<?php
//-------------------------------
//Apkparser类包开始
//-------------------------------
namespace app\common\controller;
use think\Controller;
class ApkParser extends controller{

  public function open($file){
        $apkParser = new \ApkParser\Parser($file);
        $name = $apkParser->getManifest()->getPackageName(); //获取apk包名
        $code = $apkParser->getManifest()->getVersionCode(); //获取apk版本号
        $version  =$apkParser->getManifest()->getVersionName(); //获取apk版本名称

        $labelIndex = $apkParser->getManifest()->getApplication();
    

        $labelIndex = $apkParser->getManifest()->getApplication()->getLabel(); //获取应用名称的索引
        $title = $apkParser->getResources($labelIndex); //获取应用名称的数组
        return [
            'name' => $name,
            'code' => $code,
            'version' => $version,
            'title' => $title[0]
        ];
       
    }

}